<?php
class GaoDe {
    private $key = 'ebb9f4080630482b8e0094855ab0b5a1';

    public function ip_city($ip){
        $url = "https://restapi.amap.com/v3/ip?ip={$ip}&output=json&key={$this->key}";
        $res = json_decode(file_get_contents($url));
        if($res->status == 1){
            return $res;
        }
        return false;
    }
}
